package com.diligreat.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.diligreat.action.base.BaseAction;
import com.diligreat.domain.Admin;
import com.diligreat.domain.Selection;
import com.diligreat.mapper.SelectionMapper;
import com.diligreat.service.IndexService;
import com.diligreat.util.Constants;

public class UiFrameAction extends BaseAction {
	private static final long serialVersionUID = 5004768766661154417L;
	private String parent = "";
	private String leftMenu;
	
	private IndexService indexService;
	private List<Selection> choosepro;
	
	@Override
	public String execute() throws Exception {
		parent = "top";
		return SUCCESS;
	}

	public String top() throws Exception {
		if(!parent.equals("top")){
			return "main";
		}
		return SUCCESS;
	}
	
	public String left() throws Exception {
		if(!parent.equals("top")){
			return "main";
		}
		Admin admin = (Admin) getSession().get(Constants.SESSION_KEY_OP);
		//if("root".equals(admin.getOpName())){
			//如果是root用户则使用root专用的权限菜单
			//return "rootSucc";
		//}
		//leftMenu = admin.getMenu();
		return SUCCESS;
	}
	
	public String right() throws Exception {
		if(!parent.equals("top")){
			return "main";
		}
		return SUCCESS;
	}
	
	
	
	public String demo()
	{
		this.choosepro=this.indexService.getAllSelectionByOrder(1);
		
		return SUCCESS;
	}
	
	/////////////////////////////////////////
	public String getParent() {
		return parent;
	}

	public void setParent(String parent) {
		this.parent = parent;
	}

	public String getLeftMenu() {
		return leftMenu;
	}

	public void setIndexService(IndexService indexService) {
		this.indexService = indexService;
	}

	public List<Selection> getChoosepro() {
		return choosepro;
	}

	public void setChoosepro(List<Selection> choosepro) {
		this.choosepro = choosepro;
	}

	

}
